package day12.homework1;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        UserService userService = new UserService();
        while (true) {
            User user = new User();
            System.out.print("请输入要注册的用户名[字母开头5~10位]:");
            user.setUsername(input.next());
            System.out.print("请输入要注册的密码[字母开头5~10位]:");
            user.setPassword(input.next());
            try {
                userService.register(user);
                System.out.println("注册成功");
            } catch (AccountExistException e) {
                System.out.println("用户名已经存在!");
            } catch (IllegalDataException e) {
                System.out.println("数据录入不合法!");
            }
        }

    }
}
